# Maintainer: Andrew Sun <adsun701@gmail.com>

_pyname=pywt
_realname=pywavelets
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}")
pkgver=1.0.3
pkgrel=1
pkgdesc="Discrete Wavelet Transforms in Python (mingw-w64)"
arch=('any')
license=('MIT')
url="https://github.com/PyWavelets/pywt"
depends=("${MINGW_PACKAGE_PREFIX}-python2-numpy"
         "${MINGW_PACKAGE_PREFIX}-python2")
makedepends=("${MINGW_PACKAGE_PREFIX}-python2-setuptools"
             "${MINGW_PACKAGE_PREFIX}-cython2")
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/PyWavelets/${_pyname}/archive/v${pkgver}.tar.gz")
sha256sums=('b152d4b551e3b454217c907e8722f7d8dc0adf104e6b3a8657d07e4020a990f2')

build() {
  msg "Python 2 build for ${CARCH}"
  rm -rf python2-build-${CARCH}
  cp -r "${_pyname}-${pkgver}" "python2-build-${CARCH}"
  cd "${srcdir}/python2-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python${pver} setup.py build
}

package() {
  cd "${srcdir}/python2-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE"
}
